from template import *

from sqlalchemy import *
from my.sqlalchemy.model.definition import model

class ExampleTblAuthenPlugin(TemplateAuthenticationPlugin):
    """a plugin example"""
    
    def authenticate(self, username, password):
        response = False
        session = create_session()
        authedUser = session.query(model.User).selectfirst(and_(model.User.c.username==username, model.User.c.password==password))
        if authedUser:
            response = True
        session.close()
        return response
    
